<?php
/*
    
    Copyright (C)  2012 Sweta ray.
    Permission is granted to copy, distribute and/or modify this document
    under the terms of the GNU Free Documentation License, Version 1.3
    or any later version published by the Free Software Foundation;
    with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
    A copy of the license is included in the section entitled "GNU
    Free Documentation License"
	@license GNU/GPL http://www.gnu.org/copyleft/gpl.html
    Questions for Joomla
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>
   
	Questions for Joomla
	Version 0.0.1
	Created date: Sept 2012
	Creator: Sweta Ray
	Email: admin@phpseo.net
	support: support@phpseo.net
	Website: http://www.phpseo.net
*/

defined('_JEXEC') or die('Restricted access'); 
$app = JFactory::getApplication();
$params = $app->getParams();
JHTML::_('behavior.modal');
$articleid = $params->get('helparticleid', 1);
$favlimit = $params->get('favlimit', 2);
$tagsCount = $params->get('tagsCount', 5);

//echo $profile->profile['address1'];
//var_dump($user[0]);

$doc = JFactory::getDocument();
$doc->addStyleSheet("components/com_questions/css/profiles.css");
$doc->addStyleSheet("components/com_questions/css/simple-profile.css");
$doc->addScript("components/com_questions/media/js/ui/jquery-1.8.2.js");

//$doc->addScript("http://maps.google.com/maps/api/js?sensor=false");
jimport('joomla.html.pagination');
$app	= JFactory::getApplication();
$total= 13;
$app =& JFactory::getApplication();
/*
$limit = $mainframe->getUserStateFromRequest('global.list.limit','limit', $mainframe->getCfg('list_limit'));
$limitstart = $mainframe->getUserStateFromRequest(JRequest::getVar('option').'limitstart','limitstart', 0);
*/
// List state information
            $limit = $app->getUserStateFromRequest('global.list.limit', 'limit', $app->getCfg('list_limit'));
            $limitstart = JRequest::getVar('limitstart', 0, '', 'int');
?>
<form>   
<div style="position: relative;">

<ul style="float:left;list-style-type: none;">
    <?php
	    //$obj = json_decode($rows);
		$rows= $this->arrayUnique($this->getTags());
		$i=0;
		if ($rows):
			foreach ($rows as $row2):
					
				   //$row 	 = $this->string_sanitize($row);
					$row2 	 = json_decode($row2);
					//var_dump($row2);	
					foreach ($row2 as $row):
					 if (@$tmp++ < $limit){
					//var_dump($row);				
				?>
               
				<div class="question-li-box">
					<li rel="tag" title="" >
					<a class="question-tag" href="<?php echo JRoute::_("index.php?option=com_questions&view=questions&tag=" . $row); ?>"><?php echo $row; ?></a>
                    <span class="tag-multiples"><span class="x-factor">×</span>&nbsp;<span class="tag-count">
                    <?php echo $this->countTags($row); ?>
                    </span>
                    </span>
                    </li>
                    
                </div>
				<?php 
			    }
				$i++;
				endforeach;
				
			endforeach;
			$total=$i;
		endif;
	?>
</ul>
	
</div>	

<?php 
$pagination = new JPagination($total, intval($limitstart),intval($limit));
var_dump($limitstart);
var_dump($limit);
var_dump($total);
$pagination_footer = $pagination->getListFooter();
echo $pagination_footer;
?>
</form>
<div>
<?php /**********Kindly dont remove this credit. For getting any support from us this link should be intact************/ 
	CopyrightHelper::copyright();
?>

</div>
